<div class="page-title">
    <h1 class="page-header">Changes in more detail</h1>
</div>

<div class="well col-sm-4">
    <table class="table table-condensed">
        <tr>
            <th><?= $logModel->getAttributeLabel('entity') ?></th>
            <td><?= $logModel->entity ?></td>
        </tr>
        <tr>
            <th><?= $logModel->getAttributeLabel('entity_id') ?></th>
            <td><?= $logModel->entity_id ?></td>
        </tr>
        <tr>
            <th><?= $logModel->getAttributeLabel('user_id') ?></th>
            <td><?= $logModel->user_id ?></td>
        </tr>
        <tr>
            <th><?= $logModel->getAttributeLabel('action') ?></th>
            <td><?= $logModel->action ?></td>
        </tr>
        <tr>
            <th><?= $logModel->getAttributeLabel('create_time') ?></th>
            <td><?= $logModel->create_time ?></td>
        </tr>
    </table>
</div>

<div class="table-responsive">
    <table class="table table-condensed">
        <thead>
            <th>Column name</th>
            <th>Old value</th>
            <th>New value</th>        
        </thead>
        <?php 
        $previous_data = unserialize($logModel->previous_data);
        $current_data  = unserialize($logModel->current_data);

        foreach ($loggedModel->attributes as $key => $value) {
            if (!in_array($key, $this->module->excludedColumns)) {
                echo '<tr>';
                echo '<td>' . $loggedModel->getAttributeLabel($key) . '</td>';

                if (isset($previous_data[$key])) {
                    echo '<td>' . $previous_data[$key] . '</td>';
                } else {
                    echo '<td></td>';
                }

                if (isset($current_data[$key])) {
                    if ($current_data[$key] != $previous_data[$key]) {
                        echo '<td class="success">' . $current_data[$key] . '</td>';
                    } else {
                        echo '<td>' . $current_data[$key] . '</td>';
                    }
                } else {
                    echo '<td></td>';
                }
                echo '</tr>';
            }
        }
        ?>
    </table>
</div>